<?php
define('_DS',DIRECTORY_SEPARATOR);
require_once dirname(dirname(__FILE__))._DS.'etc'._DS.'define.php';
$uri = G::uri();
if (_CHANNEL=='www' || $uri=='' || $uri=='/') {//index (channel), sitemap, aboutus ...
	$model = 'index';
} else {
	$model = 'article';//article
	if (substr($uri,0,3)=='/t/') {//tag
		$model = 'tag';
	}
}
$model = ucfirst($model);
//action mapping
if (!file_exists(_LIB."class.$model.php")) G::p404("Model '$model' not exist.");
require_once "class.$model.php";
$$model = new $model();
if (!isset($action)||!$action) $action = "default_action";
if (substr($action,-5)=='.html') $action = substr($action,0,-5);
if (!method_exists($$model, $action)) G::p404("Action '$action' not exists");
//user_error("<p style='border:1px dotted blue'>Calling Class <b>{$model}</b> Method <b>$action</b></p>");
call_user_func(array($$model, $action));

echo "\n<!-- ".G::microtime(__T_PAGE_START_)." -->\n";